/**
 * 自定义函数
 * */


//列表
function getList(){
    var uinfo = getAdminInfo();
    if (!uinfo) { return }
    var pageStart = getParamByUrl('start');
    pageStart = pageStart ? pageStart : pages.start;
    var formData = {
        uid: uinfo.uid,
        //role_id: uinfo.role_id,
        depart_id: uinfo.depart_id,
        start: pageStart, limit: pages.limit,
    };
    $.ajax({
        type: apiMethod,
        url: apiDomain + 'tongji/item',
        data: formData,
        success: function (res) {
            console.log(res);
            var h = '', tbody = $('tbody');
            if (res.code < 0) {
                h = '<tr class="text-c">';
                h += '<td colspan="10">没有记录</td>';
                h += '</tr>';
                tbody.html(h);
                return
            }
            tbody.html(getHtml(res.data));
            $('#pageTotal').html(res.total);
            pages.total = res.total;
            pageHtml(pages);
        },
        error: function () {
            console.log('网络错误');
        }
    });
}
//列表字符串
function getHtml(d){
    var h = '', i;
    h += '';
    for (i = 0; i < d.length; i ++) {
        h += '<tr class="text-c">';
        h += '<td>' + d[i].id + '</td>';
        h += '<td>' + d[i].staff_title + '</td>';
        h += '<td>' + d[i].item_title + '</td>';
        h += '<td>';
        h += '【' + d[i].wh_title;
        h += '】' + d[i].title;
        h += '</td>';
        h += '<td>' + d[i].delay + '分</td>';
        h += '</tr>';
    }
    return h;
}